package clientView;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Locale;
import java.util.Vector;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.UIManager;

import objectView.EmSalarySheet;
import objectView.EmTimeSheet;
import objectView.EmployeeDepCom;
import objectView.EmployeeInfo;
import utility.DayMonthYear;
import utility.StringUtil;
import clientMain.Main;
import clientUtilGUI.KeyValue;
import clientUtilGUI.UtilityGUI;

import com.toedter.calendar.JMonthChooser;
import com.toedter.calendar.JYearChooser;

public class Excel extends JScrollPane implements ActionListener{
	
	private JPanel panel;
	private JPanel panelHeader;
	private JPanel panelBody;
	private JRadioButton rdbtnDep;
	private JRadioButton rdbtnEmployee;
	private JRadioButton rdbtnTSSS;
	private ButtonGroup groupCondition1;
	private ButtonGroup groupCondition2;
	private JRadioButton rdbtnCond2_1;
	private JRadioButton rdbtnCond2_2;
	private JButton btnPrintExcel;
	private JPanel panelBtn;
	private JPanel panelCondition2;
	private GridBagConstraints gbc_panelCondition2;
	private JMonthChooser monthChooser;
	private JYearChooser yearChooser;
	private GridBagConstraints gbc_panelBtn;
	private JPanel panelCondition3;
	private GridBagConstraints gbc_panelCondition3;
	private JComboBox cbbDep;
	private JTextField txtEmId;
	private JButton btnCancel;
	private JLabel lblResult;
	

	public Excel() {
		panel = new JPanel();
		setViewportView(panel);
		GridBagLayout gbl_panel = new GridBagLayout();
		gbl_panel.columnWidths = new int[]{0};
		gbl_panel.rowHeights = new int[]{0, 01};
		gbl_panel.columnWeights = new double[]{1.0};
		gbl_panel.rowWeights = new double[]{0.0, 1.0};
		panel.setLayout(gbl_panel);
		
		panelHeader = UtilityGUI.headerForm("Báo Cáo Thống Kê");
		GridBagConstraints gbc_panelHeader = new GridBagConstraints();
		gbc_panelHeader.insets = new Insets(8, 10, 10, 10);
		gbc_panelHeader.fill = GridBagConstraints.BOTH;
		gbc_panelHeader.gridx = 0;
		gbc_panelHeader.gridy = 0;
		panel.add(panelHeader, gbc_panelHeader);
		
		panelBody = new JPanel();
		GridBagConstraints gbc_panelBody = new GridBagConstraints();
		gbc_panelBody.insets = new Insets(5, 10, 10, 10);
		gbc_panelBody.fill = GridBagConstraints.BOTH;
		gbc_panelBody.gridx = 0;
		gbc_panelBody.gridy = 1;
		panel.add(panelBody, gbc_panelBody);
		GridBagLayout gbl_panelBody = new GridBagLayout();
		gbl_panelBody.columnWidths = new int[]{0, 0, 0, 0, 0};
		gbl_panelBody.rowHeights = new int[]{0, 0, 0, 0, 0, 0};
		gbl_panelBody.columnWeights = new double[]{0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
		gbl_panelBody.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
		panelBody.setLayout(gbl_panelBody);
		
		Cond1Listener c1Listener = new Cond1Listener();
		JLabel lblCondition1 = new JLabel("Lựa chọn :");
		lblCondition1.setFont(UtilityGUI.fontLblForm);
		GridBagConstraints gbc_lblCondition1 = new GridBagConstraints();
		gbc_lblCondition1.anchor = GridBagConstraints.WEST;
		gbc_lblCondition1.insets = new Insets(3, 5, 5, 5);
		gbc_lblCondition1.gridx = 0;
		gbc_lblCondition1.gridy = 0;
		panelBody.add(lblCondition1, gbc_lblCondition1);
		
		rdbtnDep = new JRadioButton("Phòng Ban");
		rdbtnDep.setFont(UtilityGUI.fontLblForm);
		rdbtnDep.addItemListener(c1Listener);
		GridBagConstraints gbc_rdbtnDep = new GridBagConstraints();
		gbc_rdbtnDep.anchor = GridBagConstraints.WEST;
		gbc_rdbtnDep.insets = new Insets(3, 0, 5, 5);
		gbc_rdbtnDep.gridx = 1;
		gbc_rdbtnDep.gridy = 0;
		panelBody.add(rdbtnDep, gbc_rdbtnDep);
		
		rdbtnEmployee = new JRadioButton("Nhân Viên");
		rdbtnEmployee.setFont(UtilityGUI.fontLblForm);
		rdbtnEmployee.addItemListener(c1Listener);
		GridBagConstraints gbc_rdbtnEmployee = new GridBagConstraints();
		gbc_rdbtnEmployee.anchor = GridBagConstraints.WEST;
		gbc_rdbtnEmployee.insets = new Insets(3, 0, 5, 5);
		gbc_rdbtnEmployee.gridx = 2;
		gbc_rdbtnEmployee.gridy = 0;
		panelBody.add(rdbtnEmployee, gbc_rdbtnEmployee);
		
		rdbtnTSSS = new JRadioButton("Lương Công");
		rdbtnTSSS.setFont(UtilityGUI.fontLblForm);
		rdbtnTSSS.addItemListener(c1Listener);
		GridBagConstraints gbc_rdbtnTSSS = new GridBagConstraints();
		gbc_rdbtnTSSS.anchor = GridBagConstraints.WEST;
		gbc_rdbtnTSSS.insets = new Insets(3, 0, 5, 5);
		gbc_rdbtnTSSS.gridx = 3;
		gbc_rdbtnTSSS.gridy = 0;
		panelBody.add(rdbtnTSSS, gbc_rdbtnTSSS);
		
		groupCondition1 = new ButtonGroup();
		groupCondition1.add(rdbtnDep);
		groupCondition1.add(rdbtnEmployee);
		groupCondition1.add(rdbtnTSSS);
		
		panelCondition2 = new JPanel();		
		gbc_panelCondition2 = new GridBagConstraints();
		gbc_panelCondition2.insets = new Insets(3, 5, 5, 5);
		gbc_panelCondition2.gridwidth = 4;
		gbc_panelCondition2.fill = GridBagConstraints.BOTH;
		gbc_panelCondition2.gridx = 0;
		gbc_panelCondition2.gridy = 1;
		panelBody.add(panelCondition2, gbc_panelCondition2);
		
		panelCondition3 = new JPanel();
		gbc_panelCondition3 = new GridBagConstraints();
		gbc_panelCondition3.insets = new Insets(3, 5, 5, 5);
		gbc_panelCondition3.gridwidth = 4;
		gbc_panelCondition3.fill = GridBagConstraints.BOTH;
		gbc_panelCondition3.gridx = 0;
		gbc_panelCondition3.gridy = 2;
		panelBody.add(panelCondition3, gbc_panelCondition3);
		
		panelBtn = new JPanel();
		gbc_panelBtn = new GridBagConstraints();
		gbc_panelBtn.insets = new Insets(3, 5, 5, 5);
		gbc_panelBtn.gridwidth = 4;
		gbc_panelBtn.fill = GridBagConstraints.BOTH;
		gbc_panelBtn.gridx = 0;
		gbc_panelBtn.gridy = 3;
		panelBody.add(panelBtn, gbc_panelBtn);
		btnPrintExcel = new JButton(UtilityGUI.btnPrintExcel);
		btnPrintExcel.setFont(UtilityGUI.fontBtnForm);
		btnPrintExcel.addActionListener(this);
		panelBtn.add(btnPrintExcel);
		btnCancel = new JButton(UtilityGUI.btnCancel);
		btnCancel.setFont(UtilityGUI.fontBtnForm);
		btnCancel.addActionListener(this);
		panelBtn.add(btnCancel);
		panelBtn.setVisible(false);
		
		lblResult = new JLabel("");
		lblResult.setFont(UtilityGUI.fontLblForm);
		lblResult.setForeground(UtilityGUI.colorNote);
		GridBagConstraints gbc_lblResult = new GridBagConstraints();
		gbc_lblResult.anchor = GridBagConstraints.NORTHWEST;
		gbc_lblResult.gridwidth = 4;
		gbc_lblResult.insets = new Insets(3, 5, 5, 5);
		gbc_lblResult.gridx = 0;
		gbc_lblResult.gridy = 4;
		panelBody.add(lblResult, gbc_lblResult);
		
	}
	
	private JPanel condition2(String c1){
		Cond2Listener c2Listener = new Cond2Listener();
		JPanel panel = new JPanel();
		GridBagLayout gbl_panel = new GridBagLayout();
		gbl_panel.columnWidths = new int[]{0, 0, 0, 0};
		gbl_panel.rowHeights = new int[]{0, 0};
		gbl_panel.columnWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panel.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panel.setLayout(gbl_panel);
		
		JLabel lblCondition2 = new JLabel("Báo Cáo :");
		lblCondition2.setFont(UtilityGUI.fontLblForm);
		GridBagConstraints gbc_lblCondition2 = new GridBagConstraints();
		gbc_lblCondition2.anchor = GridBagConstraints.WEST;
		gbc_lblCondition2.insets = new Insets(0, 0, 0, 5);
		gbc_lblCondition2.gridx = 0;
		gbc_lblCondition2.gridy = 0;
		panel.add(lblCondition2, gbc_lblCondition2);
		
		rdbtnCond2_1 = new JRadioButton();
		rdbtnCond2_2 = new JRadioButton();
		if(c1.equals("dep") || c1.equals("em")){
			rdbtnCond2_1.setText("Danh Sách Sơ Bộ");
			rdbtnCond2_2.setText("Thông Tin Chi Tiết");
		}else if(c1.equals("tsss")){
			rdbtnCond2_1.setText("Bảng Chấm Công");
			rdbtnCond2_2.setText("Chấm Công và Lương");
		}
		rdbtnCond2_1.setFont(UtilityGUI.fontLblForm);
		rdbtnCond2_1.addItemListener(c2Listener);
		GridBagConstraints gbc_rdbtnCond2_1 = new GridBagConstraints();
		gbc_rdbtnCond2_1.anchor = GridBagConstraints.WEST;
		gbc_rdbtnCond2_1.insets = new Insets(0, 0, 0, 5);
		gbc_rdbtnCond2_1.gridx = 1;
		gbc_rdbtnCond2_1.gridy = 0;		
		panel.add(rdbtnCond2_1, gbc_rdbtnCond2_1);		
		
		rdbtnCond2_2.setFont(UtilityGUI.fontLblForm);
		rdbtnCond2_2.addItemListener(c2Listener);
		GridBagConstraints gbc_rdbtnCond2_2 = new GridBagConstraints();
		gbc_rdbtnCond2_2.anchor = GridBagConstraints.WEST;
		gbc_rdbtnCond2_2.insets = new Insets(0, 0, 0, 5);
		gbc_rdbtnCond2_2.gridx = 2;
		gbc_rdbtnCond2_2.gridy = 0;
		panel.add(rdbtnCond2_2, gbc_rdbtnCond2_2);
		
		groupCondition2 = new ButtonGroup();
		groupCondition2.add(rdbtnCond2_1);
		groupCondition2.add(rdbtnCond2_2);
		
		return panel;
	}
	
	private JPanel conditionDep(String c2){
		JPanel panel = new JPanel();
		GridBagLayout gbl_panel = new GridBagLayout();
		gbl_panel.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
		gbl_panel.rowHeights = new int[]{0, 0};
		gbl_panel.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panel.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panel.setLayout(gbl_panel);
		
		JLabel lblSelect = new JLabel("Chọn :");
		lblSelect.setFont(UtilityGUI.fontLblForm);
		GridBagConstraints gbc_lblSelect = new GridBagConstraints();
		gbc_lblSelect.insets = new Insets(0, 0, 0, 5);
		gbc_lblSelect.anchor = GridBagConstraints.WEST;
		gbc_lblSelect.gridx = 0;
		gbc_lblSelect.gridy = 0;
		panel.add(lblSelect, gbc_lblSelect);
		
		GridBagConstraints gbc_select = new GridBagConstraints();
		gbc_select.insets = new Insets(0, 0, 0, 5);
		gbc_select.anchor = GridBagConstraints.WEST;
		gbc_select.gridx = 1;
		gbc_select.gridy = 0;
		if(c2.equals("l")){
			JLabel lblList = new JLabel("Toàn Bộ Phòng Ban");
			lblList.setFont(UtilityGUI.fontLblForm);
			lblList.setForeground(UtilityGUI.colorLblForm);			
			panel.add(lblList, gbc_select);
		}else if(c2.equals("i")){
			cbbDep = UtilityGUI.getComboBox("Department", 0, "");
			panel.add(cbbDep, gbc_select);
		}				
		return panel;
	}
	
	private JPanel conditionEm(String c2){
		JPanel panel = new JPanel();
		GridBagLayout gbl_panelTime = new GridBagLayout();
		gbl_panelTime.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
		gbl_panelTime.rowHeights = new int[]{0, 0};
		gbl_panelTime.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panelTime.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panel.setLayout(gbl_panelTime);
		
		JLabel lblSelect = new JLabel();
		lblSelect.setFont(UtilityGUI.fontLblForm);
		GridBagConstraints gbc_lblSelect = new GridBagConstraints();
		gbc_lblSelect.insets = new Insets(0, 0, 0, 5);
		gbc_lblSelect.anchor = GridBagConstraints.WEST;
		gbc_lblSelect.gridx = 0;
		gbc_lblSelect.gridy = 0;
		panel.add(lblSelect, gbc_lblSelect);
		if(c2.equals("l")){
			lblSelect.setText("Lựa Chọn :");
		}else if(c2.equals("i")){
			lblSelect.setText("Mã NV :");
		}		
		
		GridBagConstraints gbc_select = new GridBagConstraints();
		gbc_select.insets = new Insets(0, 0, 0, 5);
		gbc_select.anchor = GridBagConstraints.WEST;
		gbc_select.gridx = 1;
		gbc_select.gridy = 0;
		if(c2.equals("l")){
			cbbDep = UtilityGUI.getComboBox("Department", 0,"");
			cbbDep.removeItemAt(0);
			cbbDep.addItem("Toàn Công Ty");
			cbbDep.setSelectedItem("Toàn Công Ty");
			panel.add(cbbDep, gbc_select);
		}else if(c2.equals("i")){
			txtEmId = new JTextField();
			txtEmId.setColumns(15);
			panel.add(txtEmId, gbc_select);
		}				
		return panel;
	}
	
	private JPanel conditionTSSS(String c2){
		JPanel panel = new JPanel();
		GridBagLayout gbl_panel = new GridBagLayout();
		gbl_panel.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0};
		gbl_panel.rowHeights = new int[]{0, 0};
		gbl_panel.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panel.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panel.setLayout(gbl_panel);
		
		JLabel lblMonth = new JLabel("Tháng :");
		lblMonth.setFont(UtilityGUI.fontLblForm);
		GridBagConstraints gbc_lblMonth = new GridBagConstraints();
		gbc_lblMonth.insets = new Insets(0, 0, 0, 5);
		gbc_lblMonth.anchor = GridBagConstraints.WEST;
		gbc_lblMonth.gridx = 0;
		gbc_lblMonth.gridy = 0;
		panel.add(lblMonth, gbc_lblMonth);
		
		monthChooser = new JMonthChooser();
		monthChooser.setBorder(UIManager.getBorder("ComboBox.border"));
		monthChooser.setFont(UtilityGUI.fontComboBox);
		monthChooser.setLocale(new Locale("vi"));
		monthChooser.getComboBox().setPreferredSize(new Dimension(130, 22));
		GridBagConstraints gbc_monthChooser = new GridBagConstraints();
		gbc_monthChooser.insets = new Insets(0, 0, 0, 5);
		gbc_monthChooser.anchor = GridBagConstraints.WEST;
		gbc_monthChooser.gridx = 1;
		gbc_monthChooser.gridy = 0;
		panel.add(monthChooser, gbc_monthChooser);
		
		JLabel lblYear = new JLabel("Năm :");
		lblYear.setFont(UtilityGUI.fontLblForm);
		GridBagConstraints gbc_lblYear = new GridBagConstraints();
		gbc_lblYear.insets = new Insets(0, 0, 0, 5);
		gbc_lblYear.anchor = GridBagConstraints.WEST;
		gbc_lblYear.gridx = 2;
		gbc_lblYear.gridy = 0;
		panel.add(lblYear, gbc_lblYear);
		
		yearChooser = new JYearChooser();
		yearChooser.setEndYear(Main.fullday.getYear()+1900);
		yearChooser.setStartYear(2000);
		yearChooser.setFont(UtilityGUI.fontComboBox);
		GridBagConstraints gbc_yearChooser = new GridBagConstraints();
		gbc_yearChooser.insets = new Insets(0, 0, 0, 5);
		gbc_yearChooser.fill = GridBagConstraints.HORIZONTAL;
		gbc_yearChooser.gridx = 3;
		gbc_yearChooser.gridy = 0;
		panel.add(yearChooser, gbc_yearChooser);
		
		JLabel lblSelect = new JLabel();
		lblSelect.setFont(UtilityGUI.fontLblForm);
		GridBagConstraints gbc_lblSelect = new GridBagConstraints();
		gbc_lblSelect.insets = new Insets(0, 3, 0, 5);
		gbc_lblSelect.anchor = GridBagConstraints.WEST;
		gbc_lblSelect.gridx = 4;
		gbc_lblSelect.gridy = 0;
		panel.add(lblSelect, gbc_lblSelect);
		if(c2.equals("l")){
			lblSelect.setText("Phòng ban :");
		}else if(c2.equals("i")){
			lblSelect.setText("Mã NV :");
		}
		
		GridBagConstraints gbc_select = new GridBagConstraints();
		gbc_select.insets = new Insets(0, 0, 0, 5);
		gbc_select.anchor = GridBagConstraints.WEST;
		gbc_select.gridx = 5;
		gbc_select.gridy = 0;
		if(c2.equals("l")){
			cbbDep = UtilityGUI.getComboBox("Department", 0,"");
			panel.add(cbbDep, gbc_select);
		}else if(c2.equals("i")){
			txtEmId = new JTextField();
			txtEmId.setColumns(15);
			panel.add(txtEmId, gbc_select);
		}
		
		return panel;
	}
	
	String cond1 = "";
	String cond2 = "";
	private class Cond1Listener implements ItemListener {		
		public void itemStateChanged(ItemEvent ev) {
			panelCondition2.setVisible(false);
			panelCondition3.setVisible(false);
			panelBtn.setVisible(false);
			lblResult.setText("");
	        if(ev.getSource() == rdbtnDep){
				cond1 = "dep";
			}else if(ev.getSource() == rdbtnEmployee){
				cond1 = "em";
			}else if(ev.getSource() == rdbtnTSSS){
				cond1 = "tsss";
			}
			if(cond1.isEmpty()) return;
			else{				
				panelCondition2 = condition2(cond1);
				panelBody.add(panelCondition2, gbc_panelCondition2);
			}
		}
	}

	private class Cond2Listener implements ItemListener {
		public void itemStateChanged(ItemEvent ev) {
			lblResult.setText("");
			if(ev.getSource() == rdbtnCond2_1){			
				cond2 = "l";
			}else if(ev.getSource() == rdbtnCond2_2){
				cond2 = "i";
			}
			if(cond2.isEmpty()) return;
			else{
				if(cond1.equals("dep")){
					panelCondition3.setVisible(false);
					panelCondition3 = conditionDep(cond2);
					panelBody.add(panelCondition3, gbc_panelCondition3);
					panelBtn.setVisible(true);
				}else if(cond1.equals("em")){
					panelCondition3.setVisible(false);
					panelCondition3 = conditionEm(cond2);
					panelBody.add(panelCondition3, gbc_panelCondition3);
					panelBtn.setVisible(true);
				}else if(cond1.equals("tsss")){
					panelCondition3.setVisible(false);
					panelCondition3 = conditionTSSS(cond2);
					panelBody.add(panelCondition3, gbc_panelCondition3);
					panelBtn.setVisible(true);
				}
			}
		}
	}
	

	
	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() == btnPrintExcel){
			lblResult.setText("");
			if(cond1.equals("dep")){
				if(cond2.equals("l")){
					
				}else if(cond2.equals("i")){
					
				}
				
			}else if(cond1.equals("em")){
				if(cond2.equals("l")){
					if(cbbDep.getSelectedItem() == "Toàn Công Ty"){
						Vector<EmployeeDepCom> listEmployeeInCom;
						listEmployeeInCom = Main.viewEm.getListEmInCom(true, 0, "Em_Id", true);
						/* GOI HAM IN EXCEL VOI THAM SO DAU VAO listEmployeeInCom
  							Thanh cong thi them code:
							lblResult.setText(UtilityGUI.successAction);
						*/
					}else{						
						int depId = Integer.parseInt(((KeyValue)cbbDep.getSelectedItem()).getKey());
						Vector<EmployeeDepCom> listEm;
						listEm = Main.viewEm.getListEmInDep(depId, true, false, 0, "Em_Id", true);
						/* GOI HAM IN EXCEL VOI THAM SO DAU VAO listEm
						  	Thanh cong thi them code:
							lblResult.setText(UtilityGUI.successAction);
						*/
					}	
				}else if(cond2.equals("i")){
					if(!StringUtil.isValidEmId(txtEmId.getText())){
						lblResult.setText(UtilityGUI.errorValidEmId);
						txtEmId.requestFocusInWindow();
						return;
					}
					String emId = txtEmId.getText();
					Vector<EmployeeInfo> list = Main.viewEm.searchEm(1, "Em_Id", emId);
					if(list == null || list.size() == 0){
						lblResult.setText(UtilityGUI.errorExistsEmId);
						txtEmId.requestFocusInWindow();
						return;
					}
					EmployeeInfo em = Main.viewEm.getEmployee(emId);					
					/* GOI HAM IN EXCEL VOI THAM SO DAU VAO em
					 	Thanh cong thi them code:
						lblResult.setText(UtilityGUI.successAction);
					*/
				}
				
			}else if(cond1.equals("tsss")){
				String monthYear = DayMonthYear.monthYear(monthChooser.getMonth()+1, yearChooser.getYear());
				if(cond2.equals("l")){
					
				}else if(cond2.equals("i")){
					String emId = txtEmId.getText();
					if(!StringUtil.isValidEmId(emId)){
						lblResult.setText(UtilityGUI.errorValidEmId);
						txtEmId.requestFocusInWindow();
						return;
					}
					Vector<EmployeeInfo> list = Main.viewEm.searchEm(1, "Em_Id", emId);
					if(list == null || list.size() == 0){
						lblResult.setText(UtilityGUI.errorExistsEmId);
						txtEmId.requestFocusInWindow();
						return;
					}
					emId = list.get(0).getEmId();
					Vector<EmTimeSheet> emTS = Main.viewEm.getEmTimeSheet(monthYear, emId);					
				    if(emTS == null || emTS.size() == 0){
				    	lblResult.setText(emId+" không có bảng chấm công tháng: "+monthYear+" !");
				    	return;
				    }
				    boolean check = Main.actionSS.checkExistEMSS(monthYear, emId);
				    if(check){
				    	lblResult.setText(emId+" chưa có lương tháng: "+monthYear+" !");
						return;
				    }
				    EmSalarySheet emSS = Main.viewEm.getEmSalarySheet(monthYear, emId);
				    /* GOI HAM IN EXCEL VOI THAM SO DAU VAO emTS, emSS
				 	Thanh cong thi them code:
					lblResult.setText(UtilityGUI.successAction);
				     */
				}
			}
		}else if(e.getSource() == btnCancel){
			Main.jTabbedPane.remove(this);
		}
	}
}
